<?php

// standard piece moves
function move_north($board,$pos)
{
	$board[$pos-5] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_east($board,$pos)
{
	$board[$pos+1] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_west($board,$pos)
{
	$board[$pos-1] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_south($board,$pos)
{
	$board[$pos+5] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_northwest($board,$pos)
{
	$board[$pos-6] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_northeast($board,$pos)
{
	$board[$pos-4] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_southwest($board,$pos)
{
	$board[$pos+4] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_southeast($board,$pos)
{
	$board[$pos+6] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}


// knight moves
function move_knight_northwest($board,$pos)
{
	$board[$pos-11] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_knight_northeast($board,$pos)
{
	$board[$pos-9] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_knight_eastnorth($board,$pos)
{
	$board[$pos-3] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_knight_eastsouth($board,$pos)
{
	$board[$pos+7] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_knight_southeast($board,$pos)
{
	$board[$pos+11] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_knight_southwest($board,$pos)
{
	$board[$pos+9] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_knight_westsouth($board,$pos)
{
	$board[$pos+3] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_knight_westnorth($board,$pos)
{
	$board[$pos-7] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

// pawn moves
function move_pawn_north($board,$pos)
{
	if($pos < 10)
		$board[$pos-5] = "Q";
	else
		$board[$pos-5] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_pawn_northwest($board,$pos)
{
	if($pos < 10)
		$board[$pos-6] = "Q";
	else
		$board[$pos-6] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_pawn_northeast($board,$pos)
{
	if($pos < 10)
		$board[$pos-4] = "Q";
	else
		$board[$pos-4] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_pawn_south($board,$pos)
{
	if($pos > 19)
		$board[$pos+5] = "Q";
	else
		$board[$pos+5] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_pawn_southwest($board,$pos)
{
	if($pos > 19)
		$board[$pos+4] = "Q";
	else
		$board[$pos+4] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}

function move_pawn_southeast($board,$pos)
{
	if($pos > 19)
		$board[$pos+6] = "Q";
	else
		$board[$pos+6] = $board[$pos];
	$board[$pos] = ".";
	return($board);
}





?>